layui.use(['jquery', 'form', 'layer'], function() {
    let $ = layui.jquery;
    let form = layui.form;
    let layer = layui.layer;
    let token = localStorage.getItem('token'); //获取用户token
    let user = JSON.parse(localStorage.getItem('user')); //再用JSON.parse('字符串')将user转为对象
    console.log(user);
    form.val("edit", user); //使用layui将用户信息回显

    //监听编辑事件
    form.on('submit(editbtn)', function(data) {
        let field = data.field;
        $.ajax({
            method: 'POST',
            url: '/my/userinfo',
            data: field,
            success: function(result) {
                if (result.status == 0) {
                    layer.msg('修改成功！')
                }



            }

        })
        return false;
    });



})
